package com.agileplex.codeminer.scm.svn;

import java.util.Date;

import org.tmatesoft.svn.core.SVNProperty;

import com.agileplex.codeminer.scm.IFile;

/** 
 * File entry in subversion repository
 * 
 * @creator Weiming Yin
 * @date 2007-6-6
 *
 * @lastmodified
 * @author $Author: yinweiming $
 * @version $Revision: 15 $, $Date: 2007-07-16 18:12:59 +0000 (Mon, 16 Jul 2007) $
 */
public class SvnFile implements IFile {

	private String name;
	private SvnVersion v;
	private SvnDirectory parent;
    
    private String author;
    private Date date;
    
    private String content;
    private String mimeType;
    private boolean isTextFile = false;
    
	
	public String getMimeType() {
		return mimeType;
	}

	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
		this.isTextFile = SVNProperty.isTextMimeType(mimeType);
	}

	public SvnFile(String name, SvnVersion v, SvnDirectory parent) {
		this.name = name;
		this.v = v;
		this.parent = parent;
	}
	
	public SvnDirectory getParentDir() {
		return this.parent;
	}

	public SvnVersion getVersion() {
		return v;
	}

	public String getName() {
		return name;
	}

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
    
	public String toString() {
		return "[" + v + "] " + name;
	}

	public String getContent() {
		return isTextFile ? content : "";
	}

	public void setContent(String content) {
		this.content = content;
	}

	public boolean isTextFile() {
		return isTextFile;
	}
}
